
<%@page import="entity.bean.Show"%>
<%@page import="entity.bean.Movie"%>
<%@page import="entity.bean.Ticket"%>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <title>Confirmation Page</title>
</head>

<body>
    <%
        Movie selectedMovie = (Movie) session.getAttribute("selectedMovie");
        Show selectedTimeSection = (Show) session.getAttribute("selectedTimeSection");
        Integer amount = (Integer) session.getAttribute("amount");
        String partialPayment = (String) session.getAttribute("partialPayment");
        String cardNumber = (String) session.getAttribute("cardNumber");
        String paymentMethod = (String) session.getAttribute("paymentMethod");
        String cardType = (String) session.getAttribute("cardType");
        Ticket[] orderedTicket = (Ticket[]) session.getAttribute("orderedTicket");
        String loyaltyPt = (String) session.getAttribute("loyaltyPt");
        int noOfTickets = ((Integer) session.getAttribute("noOfSeatMarked")).intValue();
        int standardPrice = selectedTimeSection.getPrice();
        int discountPrice = selectedTimeSection.getPrice() - 15;

    %>
    <div id="container">
        <div id="header">
            <div class="noncontent" id="logo">
                <span>
                    <img src="image/logo.jpg" width="200" height="200" alt="logo"/>
                </span>
            </div>

            <div class="noncontent" id="title">
                <h1>Cult Cinema</h1>
            </div>
        </div>

        <div id="body">
            <div id="Menu">
                <a href="index.jsp">Home</a>
                <a href="Index">Movies</a>
                <a href="member.jsp">Member</a>
                <a href="administrator.jsp">administrator</a>
            </div>
            <div id="content">
                <form name="info" action="Confirmation" method="GET">
                    <table border="1">
                        <tr><td colspan="2">Movie Information</td></tr>
                        <tr><td>Name:</td><td><%=selectedMovie.getName()%></td></tr>
                        <tr><td>Cinema:</td><td>Cult Cinema</td></tr>
                        <tr><td>House:</td><td>House<%=selectedTimeSection.getHouseID()%></td></tr>
                        <tr><td>Date and Time:</td><td><%=selectedTimeSection.getTimeString()%></td></tr>
                        <tr><td colspan="2">Payment Information</td></tr>
                        <tr>
                            <td>Payment method:</td>
                            <td>
                                <%if (paymentMethod.equals("card")) {%>
                                Credit Card
                            </td>
                        </tr> 
                        <tr><td>Credit Card Type:</td><td>
                                <%if (cardType.equals("visa")) {%>
                                VISA
                                <%} else if (cardType.equals("master")) {%>
                                MasterCard
                                <%} else {%>
                                American Express
                                <%}%>

                            </td></tr>
                        <tr><td>Credit Card No:</td><td><%=cardNumber%></td></tr>
                        <%} else {%>
                        Loyalty Point 
                        </td></tr>
                        <%}%>
                        <tr><td>Amount:</td><td>$<%=amount%></td></tr>
                        <%if (partialPayment != null || paymentMethod.equals("point")) {%>
                        <tr><td>Loyal Point used:</td><td><%=loyaltyPt%></td></tr>
                        <%}%>
                        <tr><td colspan="2">Tickets information:</td></tr>
                        <tr><td>Number Of Tickets:</td><td><%=noOfTickets%></td></tr>
                        <%for (int i = 0; i < noOfTickets; i++) {%>
                        <tr><td>seat:&nbsp;<%=(char) (orderedTicket[i].getRowNo() + 'A' - 1)%><%=orderedTicket[i].getColNo()%></td><td>
                                <%if (orderedTicket[i].getDiscount()) {%>
                                $<%=discountPrice%> Children/Student/Senior
                                <%} else {%>
                                $<%=standardPrice%> Standard
                                <%}%>
                            </td></tr>
                            <%}%>
                    </table>
                    <input class="nonprint" type="submit" value="Confirm" />
                    <input class="nonprint" type="button" value="Print" onclick="window.print();"/>
                </form>
            </div>
        </div>
        <div class="noncontent" id="footer">
            <span>
                <a href="" >Privacy Policy</a>
                <a href="" >Terms Conditions</a>
                <a href="" >About Us</a> 
                <a href="" >Contact Us</a>
            </span>
            <br/>
            <span id="copyright">Copyright © Chris Ng and Lusinda Leung. All Rights Reserved.<br/></span>
            <span id="warning">
                This web site exists to fulfill the coursework requirement of CS4280. Do not use your real personal data as input.
            </span>
        </div>
    </div>
</body>

</html>